package com.yanjiali.feign;

import com.yanjiali.config.feign.OAuth2FeignConfig;
import com.yanjiali.model.R;
import com.yanjiali.model.req.UpdateArticleCollectNumReq;
import com.yanjiali.model.resp.GetByIdArticleNoNeedAuthorResp;
import com.yanjiali.model.resp.UpdateArticleCollectNumResp;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Package: com.yanjiali.feign
 * @Author: yanjiali
 * @Created: 2025/4/26 20:06
 */
@FeignClient(name = "article-service", path = "/v1/articles", configuration = OAuth2FeignConfig.class)
public interface ArticleServiceFeign {

    @GetMapping("/getByIdArticleNoNeed")
    @ApiOperation("通过id获取文章（无需作者本人）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "articleId", value = "对应文章id")
    })
    R<GetByIdArticleNoNeedAuthorResp> getByIdArticleNoNeedAuthor(@RequestParam("id") Long articleId);

    @PostMapping("/updateArticleCollectNum")
    @ApiOperation("修改文章收藏数接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "updateArticleCollectNumReq", value = "文章修改收藏数量请求参数")
    })
    R<UpdateArticleCollectNumResp> updateArticleCollectNum(@RequestBody UpdateArticleCollectNumReq updateArticleCollectNumReq);
}
